package com.egg.ylt.controls;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.egg.ylt.R;
import com.egg.ylt.pojo.SwimHistoryEntity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * author:        yupeng
 * created on:    2019/2/25 16:51
 * description:   游泳纪录头布局
 */
public class HEAD_SwimHistroy extends RelativeLayout {

    @BindView(R.id.delete_button)
    ImageView deleteButton;
    @BindView(R.id.tips_layout)
    RelativeLayout tipsLayout;
    @BindView(R.id.calorie_txt)
    TextView calorieTxt;
    @BindView(R.id.swim_time_txt)
    TextView swimTimeTxt;
    @BindView(R.id.swim_count_txt)
    TextView swimCountTxt;
    @BindView(R.id.weigh_count_txt)
    TextView weighCountTxt;

    public HEAD_SwimHistroy(Context context) {
        super(context);
        LayoutInflater.from(context).inflate(R.layout.headerview_swim_record, this);
        ButterKnife.bind(this);
        deleteButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                tipsLayout.setVisibility(GONE);
            }
        });
    }

    /**
     * 展示游泳纪录数据
     *
     * @param model
     */
    public void showSwimHistory(SwimHistoryEntity model) {
        calorieTxt.setText(model.getCaloriesSum());
        swimTimeTxt.setText(model.getTimeSum());
        swimCountTxt.setText(model.getSwimsNum());
        weighCountTxt.setText(model.getMeasureNum());
    }

}
